package a07_二叉树;

/**
 * <p>
 * a04_翻转二叉树
 * </p>
 *
 * @author flyduck
 * @since 2024-08-26
 */
public class a06_翻转二叉树复习1 {

    public TreeNode invertTree(TreeNode root) {
        if (root == null) {
            return root;
        }
        invertTree(root.left);
        invertTree(root.right);

        TreeNode temp = root.left;
        root.left = root.right;
        root.right = temp;
        return root;
    }

}
